package com.mtsmda.ws.rest.jboss.services;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;

import com.mtsmda.ws.rest.jboss.services.pojo.Product;

@Path("/json/jboss")
public class JSONService {
	
	@GET
	@Path("/get")
	@Produces("application/json")
	public Product getProductInJSON(){
		
		Product product = new Product();
		product.setProductID(15);
		product.setProductName("Nokia C2-00");
		product.setProductPrice(82.5);
		
		return product;
	}
	
	@POST
	@Path("/post")
	@Consumes("application/json")
	public Response createProductInJSON(Product product){
		product = getProductInJSON();
		String result = "Result " + product.toString();
		return Response.status(200).entity(result).build();
	}
	
}